#include "process.h"

#define NUM 101
#define STYLE '='

void process()
{
    const char* lable = "|/-\\";
    int len = strlen(lable);
    char bar[NUM];

    memset(bar, '\0', sizeof(bar));

    int cnt = 0;
    while(cnt <= 100)
    {
        printf("[%-100s][%d%%]%c\r", bar, cnt + 1, lable[cnt % len]);
        fflush(stdout);
        bar[cnt++] = STYLE;
        if(cnt == 100)
        {
            bar[cnt] = '\0';
            printf("[%-100s][%d%%]%c\r", bar, cnt, lable[cnt % len]);
            break;
        }
        bar[cnt] = '>';
        usleep(50000);
    }

    printf("\r\n");

}
